// pages/skilList/skillList.js
var app = getApp()
var Bmob = require('../../utils/Bmob-2.2.0.min.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    serviceText: ["水电工", "家政保洁", "家电维修", "跑腿服务", "门窗维修", "送水"]
  },
 /**
   * 获取个人技能列表
   */

  get_service: function (userId) {
    var that = this;
  console.log(userId);
    var service = Bmob.Query("appointsment");
    service.equalTo("status", "==", 2);
    service.order("-createdAt");
    service.find().then(res => {


      that.setData({
        services: res
      })


    })

  },
  /**
 * 跳转到技能详情
 */
  turnToskill: function (e) {
    var that = this;
    var url = e.currentTarget.dataset.url;
    var id=e.currentTargetdataset.id;
    wx.navigateTo({
      url: url+"?skillId="+id,
      events: {},
      success: function (res) { }
    })
  },
   /**
   * 跳转到页面
   */
  turnTopage: function (e) {
    var that = this;
    var url = e.currentTarget.dataset.url;
    wx.navigateTo({
      url: url,
      events: {},
      success: function (res) { }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   var that=this;

    app.login().then(res => {
      console.log(app.globalData.userInfo);
      that.get_service(app.globalData.userInfo.objectId);
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})